import request from "@/request/request";
import requestMock from "@/request/requestMock";
//请求三级列表
export const reqCategoryList = ()=>{
    return request.get("/product/getBaseCategoryList")
}
export const reqBannerList = ()=>{
    return requestMock.get("/home/banner")
}

export const reqFloorList = ()=>{
    return requestMock.get("/home/floor")
}

export const reqSearchList = (searchParams)=>{
    return request.post("/list",searchParams)
}

export const reqGoodList = (skuId)=>{
    return request.get(`/item/${ skuId }`)
}

export const reqAddToCart = (skuId,skuNum)=>{
    return request.post(`/cart/addToCart/${ skuId }/${ skuNum }`)
}

export const reqCartList = ()=>{
    return request.get("/cart/cartList")
}


export const reqDeleteCart = (skuId)=>{
    return request.delete(`/cart/deleteCart/${skuId}`)
}


export const reqCheckCart = (skuId,isChecked)=>{
    return request.get(`/cart/checkCart/${skuId}/${isChecked}`)
}

export const reqBatchCheckCart = (isChecked,skuIdList)=>{
    return request.post(`/cart/batchCheckCart/${isChecked}`,skuIdList)
}

export const reqBatchDeleteCart = (skuIdList)=>{
    return request.delete(`/cart/batchDeleteCart`,{
        data:skuIdList
    })
}

export const reqVerifyCode = (phone)=>{
    return request.get(`/user/passport/sendCode/${phone}`)
}

export const reqRegister = (userInfo)=>{
    return request.post("/user/passport/register",userInfo)
}

export const reqLogin = (userInfo)=>{
    return request.post("/user/passport/login",userInfo)
}

export const reqUserInfo = ()=>{
    return request.get("/user/passport/auth/getUserInfo")
}

export const reqLogOut = ()=>{
    return request.get("/user/passport/logout")
}

export const reqUserAddress = ()=>{
    return requestMock.get("/user/userAddress/auth/findUserAddressList")
}

export const reqTrade = ()=>{
    return request.get(`/order/auth/trade`)
}

export const reqTradeNo = (tradeNo,tradeList)=>{
    return request.post(`/order/auth/submitOrder?tradeNo=${tradeNo}`,tradeList)
}

export const reqPayment =(orderId)=>{
    return request.get(`/payment/weixin/createNative/${orderId}`)
}

export const reqPayStatus = (orderId)=>{
    return request.get(`/payment/weixin/queryPayStatus/${orderId}`)
}